package com.dingreading.cloud.admin.service.impl;

import com.dingreading.cloud.admin.entity.MemberFollow;
import com.dingreading.cloud.admin.entity.table.MemberFollowTableDef;
import com.dingreading.cloud.admin.mapper.MemberFollowMapper;
import com.dingreading.cloud.admin.service.MemberFollowService;
import com.mybatisflex.core.query.QueryCondition;
import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 服务层实现。
 *
 * @author Administrator
 * @since 2024-09-12
 */
@Service
public class MemberFollowServiceImpl extends BaseServiceImpl<MemberFollowMapper, MemberFollow, MemberFollowTableDef> implements MemberFollowService {

    @Override
    protected MemberFollowTableDef getTable() {
        return MemberFollowTableDef.memberFollow;
    }

    @Override
    public List<String> listByMemberUidAndFollowTime(String uid, Date followTime) {
        QueryCondition condition = table.memberUid.eq(uid).and(table.followTime.eq(followTime));
        QueryWrapper wrapper = QueryWrapper.create()
                .select(table.uid)
                .from(table)
                .where(condition);
        return getMapper().selectObjectListByQueryAs(wrapper, String.class);
    }
}
